'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let status=2;
	let res_msg="";
	let body=event.body
	let body_json=JSON.parse(body)
	let pet_template={
		"pet_name": body_json.pet_name,
		"icon": body_json.icon,
		"degree": body_json.degree,
		"hp": body_json.hp,
		"atk": body_json.atk,
		"sp": body_json.sp,
		"ev_lv": body_json.ev_lv,
		"ev_ids": [],
		"pre_id": "",
		"default_lv": body_json.default_lv,
		"ev_map": body_json.ev_map
}

	const collection = db.collection('PetTemplate');
	let res=await collection.add(pet_template);
	res_msg="新增成功"
	//返回数据给客户端
	return {"status":status,"res_msg":res_msg}

};
